package com.qys.livesMall.system.controller.sys;

import com.qys.livesMall.system.model.dto.sys.country.CountryEdit;
import com.qys.livesMall.system.model.dto.sys.country.CountrySearch;
import com.qys.livesMall.system.model.entity.Country;
import com.qys.livesMall.system.service.CountryService;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.view.QysPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 国家
 * </p>
 *
 * @author
 * @since 2023-08-28
 */
@RestController
@RequestMapping("/sys/country")
@Tag(name = "国家区域前缀", description = "国家区域前缀")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CountryController {

    private final CountryService countryService;

    /**
     * 查询
     * @param search
     * @return
     */
    @PostMapping("/search")
    @Operation(summary = "国家列表")
    public R<QysPage<Country>> search(@RequestBody CountrySearch search){
        return R.ok(countryService.search(search));
    }

    /**
     * 编辑
     * @param countryEdit
     * @return
     */
    @PostMapping("/edit")
    @Operation(summary = "国家列表")
    public R edit(@RequestBody CountryEdit countryEdit){
       countryService.edit(countryEdit);
       return R.ok();
    }
}
